<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<%java.util.Random r=new java.util.Random();  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function checkForm2(){
		var objs = document.getElementsByName("id");
		var sign = 0;
		for(var i = 0; i < objs.length; i++){
			if(objs[i].value != 0 && objs[i].checked)sign = sign + 1;
		}
		if(sign <= 0){
			alert("请选择待操作的项！");
			return false;
		}else if(sign > 1){
			alert("只能选择一个待操作项！");
			return false;
		}
		return true;
	}

	function back(){
		window.location.href = "./contract.do";
		window.location.target = "main";
	}
	
	function updateBackCost(){
		if(checkForm2()){
			var objs = document.getElementsByName("id");
			var id = 0;
			for(var i = 0; i < objs.length; i++){
				if(objs[i].value != 0 && objs[i].checked){
					id = objs[i].value;
					break;
				}
			}
			window.location.href = "./contractBackCost.do?action=preUpdateBackCostNew&id="+id+"&sign=5";
			window.location.target = "main";
		}
	}
	
	function insertBackCost()
	{
		if(checkForm2()){
			var objs = document.getElementsByName("id");
			var id = 0;
			for(var i = 0; i < objs.length; i++){
				if(objs[i].value != 0 && objs[i].checked){
					id = objs[i].value;
					break;
				}
			}
			window.location.href = "./contractBackCost.do?action=preInsertBackCost&id="+id+"&sign=3";
			window.location.target = "main";
		}		
	}	
-->
</script>
</head>
<body>
<form name="deptBackCostNewForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab">回款信息</td>
					</tr>
					<tr>
						<td valign="bottom" class="a_tools" style="padding-left: 3px;">回款信息：
							<input id="customerName" name="customerName" class="input_query" type="text" value="${customerName}"/>
							<input id="sFlag" name="sFlag" type="hidden" value="${sFlag}"/>
							<a class="search" href="javascript:searchContract();" title="" hidefocus="true">查询</a>
							|<a class="asearch" href="javascript:advancedQueryDialog();" target="main" hidefocus="true">高级查询</a>
							<!--  暂时功能  -->
							<c:if test="${isUpdateDeptBackcost == 1}">
							|
							<a class="update" href="javascript:insertBackCost();" title="新增回款" hidefocus="true">新增回款</a>
							|
							<a class="update" href="javascript:updateBackCost();" title="修改回款" hidefocus="true">修改回款</a>
							</c:if>
						</td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td class="title_lab">部门合同</td>
						<td align="right" valign="">
							<!-- page -->
							<table class="table_page2">
								<tr>
									<td valign="bottom">
										<img src="./images/frist.bmp" onclick="pageContract(1)" alt="首页" style="vertical-align: middle;cursor: hand;">
										<img src="./images/last.bmp" onclick="pageContract(2)" alt="上一页" style="vertical-align: middle;cursor: hand;">&nbsp;
										<font color="red">${currentPage}</font>/${totalPages}&nbsp;<fmt:message key='common.page'/>&nbsp;
										<img src="./images/next.bmp" onclick="pageContract(3)" alt="下一页" style="vertical-align: middle;cursor: hand;">
										<img src="./images/end.bmp" onclick="pageContract(4)" alt="末页" style="vertical-align: middle;cursor: hand;">
										共&nbsp;&nbsp;${totalRows}&nbsp;<fmt:message key='common.page.totalRow'/>&nbsp;&nbsp;&nbsp;
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td colspan="3" height="2"></td></tr>
					<tr>
						<td valign="top" colspan="2">
							<table class="table">
								<tr>
									<td valign="top">
										<table class="table_style">
											<tr>
												<td class="title" width="8"></td>												
												<td class="title">单据号</td>
												<td class="title">回款方式</td>
												<td class="title">回款日期</td>
												<td class="title">回款金额</td>
											</tr>
											<c:forEach var="backCost" items="${backCostList}">
											<tr onmouseover="onmousemoveChange(this,'img${backCost.id}')" onmouseout="onmouseoutChange(this,'img${backCost.id}')">
												<td align="center">
													<input id="id" name="id" type="checkbox" value="${backCost.id}"/>
												</td>
												<td><a href="./contractBackCost.do?action=preUpdateBackCostNew&sign=5&id=${backCost.id}" target="main">${backCost.backCostNum}</a></td>
												<td align="left">
													<c:forEach var="range" items="${ranges['36']}">
														<c:if test="${backCost.backCostTypeId == range.id}">
															${range.rangeValue}
														</c:if>
													</c:forEach>
												</td>
												<td>
													<fmt:formatDate value="${backCost.backDate}" pattern="yyyy-MM-dd"/>
												</td>
												<td>${backCost.backCostTotal}</td>
											</tr>
											</c:forEach>
										</table>
									</td>
								</tr>
								<tr>
									<td align="left" valign="bottom">
										<!-- page -->
										<table id="tp" class="table_page">
											<tr>
												<td>&nbsp;&nbsp;
													<img src="./images/frist.bmp" onclick="pageContract(1)" alt="首页" style="vertical-align: middle;cursor: hand;">
													<img src="./images/last.bmp" onclick="pageContract(2)" alt="上一页" style="vertical-align: middle;cursor: hand;">&nbsp;
													<font color="red">${currentPage}</font>/${totalPages}&nbsp;<fmt:message key='common.page'/>&nbsp;
													<img src="./images/next.bmp" onclick="pageContract(3)" alt="下一页" style="vertical-align: middle;cursor: hand;">
													<img src="./images/end.bmp" onclick="pageContract(4)" alt="末页" style="vertical-align: middle;cursor: hand;">
													共&nbsp;&nbsp;${totalRows}&nbsp;<fmt:message key='common.page.totalRow'/>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>